R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5     v purrr   0.3.4
## v tibble  3.1.6     v dplyr   1.0.8
## v tidyr   1.2.0     v stringr 1.4.0
## v readr   2.1.2     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
## randomForest 4.7-1
## Type rfNews() to see new features/changes/bug fixes.
## 
## 다음의 패키지를 부착합니다: 'randomForest'
## The following object is masked from 'package:dplyr':
## 
##     combine
## The following object is masked from 'package:ggplot2':
## 
##     margin
## 필요한 패키지를 로딩중입니다: grid
## 필요한 패키지를 로딩중입니다: mvtnorm
## 필요한 패키지를 로딩중입니다: modeltools
## 필요한 패키지를 로딩중입니다: stats4
## 필요한 패키지를 로딩중입니다: strucchange
## 필요한 패키지를 로딩중입니다: zoo
## 
## 다음의 패키지를 부착합니다: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 필요한 패키지를 로딩중입니다: sandwich
## 
## 다음의 패키지를 부착합니다: 'strucchange'
## The following object is masked from 'package:stringr':
## 
##     boundary
## 필요한 패키지를 로딩중입니다: lattice
## 
## 다음의 패키지를 부착합니다: 'caret'
## The following object is masked from 'package:purrr':
## 
##     lift
## 
## 다음의 패키지를 부착합니다: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
rand_forest <- randomForest(data = employee_trainset,
                            Attrition ~ .,
                            importance = TRUE)
predict_forest <- predict(rand_forest, employee_testset)

confusionMatrix(predict_forest, 
                employee_testset$Attrition,
                positive = "Yes")
## Confusion Matrix and Statistics
## 
##           Reference
## Prediction  No Yes
##        No  369  53
##        Yes   6  13
##                                           
##                Accuracy : 0.8662          
##                  95% CI : (0.8308, 0.8966)
##     No Information Rate : 0.8503          
##     P-Value [Acc > NIR] : 0.1938          
##                                           
##                   Kappa : 0.2561          
##                                           
##  Mcnemar's Test P-Value : 2.115e-09       
##                                           
##             Sensitivity : 0.19697         
##             Specificity : 0.98400         
##          Pos Pred Value : 0.68421         
##          Neg Pred Value : 0.87441         
##              Prevalence : 0.14966         
##          Detection Rate : 0.02948         
##    Detection Prevalence : 0.04308         
##       Balanced Accuracy : 0.59048         
##                                           
##        'Positive' Class : Yes             
## 

#Tables

연습 인라이 r 30

import pandas as pd
3+5
## 8

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.